<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title> childNodes,nodeType,children </title>
<!-- <script type="text/javascript">
    window.onload=function(){
        var oUl=document.getElementById('ul1');
        //IE6-8
        //alert(oUl.childNodes.length);//11个，包含文本节点（6个空白的）和元素节点（5个）
        for(var i=0;i<oUl.childNodes.length;i++){
            //nodeType==3  ->文本节点
            //nodeType==1  ->元素节点
            //alert(oUl.childNodes[i].nodeType)
            if(oUl.childNodes[i].nodeType==1){
                oUl.childNodes[i].style.background='red';
            }
        }
    };
</script>    -->
<script type="text/javascript">
    window.onload=function(){
        var oUl=document.getElementById('ul1');
        alert(oUl.children.length)
    };
</script>    
</head>
<body>
    <ul id="ul1">
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
    </ul>
</body>
</html>